//package com.objetdirect.gwt.umldrawer.server.services;
//
//import javax.annotation.PostConstruct;
//import javax.annotation.PreDestroy;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Propagation;
//import org.springframework.transaction.annotation.Transactional;
//
//import com.objetdirect.gwt.umldrawer.server.dao.DeveloperDAO;
//import com.objetdirect.gwt.umldrawer.shared.dto.DeveloperDTO;
//
//@Service("developerService")
//public class DeveloperServiceImpl {
//
//	@Autowired
//	private DeveloperDAO developerDAO;
//
//	@PostConstruct
//	public void init() throws Exception {
//	}
//
//	@PreDestroy
//	public void destroy() {
//	}
//
//	public DeveloperDTO findDeveloper(String developerId) {
//
//		return developerDAO.findById(developerId);
//
//	}
//
//	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//	public void saveDeveloper(String developerEmail, String firstName,
//			String lastName, String password, int onlineStatus)
//			throws Exception {
//
//		DeveloperDTO DeveloperDTO = developerDAO.findById(developerEmail);
//
//		if (DeveloperDTO == null) {
//			DeveloperDTO = new DeveloperDTO(developerEmail, firstName,
//					lastName, password, onlineStatus);
//			developerDAO.persist(DeveloperDTO);
//		}
//
//	}
//
//	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//	public void updateDeveloper(String developerEmail, String firstName,
//			String lastName, String password, int onlineStatus)
//			throws Exception {
//
//		DeveloperDTO DeveloperDTO = developerDAO.findById(developerEmail);
//
//		if (DeveloperDTO != null) {
//			DeveloperDTO.setFirstName(firstName);
//			DeveloperDTO.setLastName(lastName);
//			DeveloperDTO.setPassword(password);
//			DeveloperDTO.setOnlineStatus(onlineStatus);
//		}
//
//	}
//
//	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//	public void deleteDeveloper(String developerEmail) throws Exception {
//
//		DeveloperDTO DeveloperDTO = developerDAO.findById(developerEmail);
//
//		if (DeveloperDTO != null)
//			developerDAO.remove(DeveloperDTO);
//
//	}
//
//	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//	public void saveOrUpdateDeveloper(String developerEmail, String firstName,
//			String lastName, String password, int onlineStatus)
//			throws Exception {
//
//		DeveloperDTO DeveloperDTO = new DeveloperDTO(developerEmail, firstName,
//				lastName, password, onlineStatus);
//
//		developerDAO.merge(DeveloperDTO);
//
//	}
//
//}
